#include <iostream>

using namespace std ;

class A
{
	public:
    virtual void f()
	{
		cout << "A" << endl ;
	}
} ;


class B : public A
{
	public:
    virtual void f()
	{
		cout << "B" << endl ;
	}
} ;

void print( A *tmp)
{
	tmp->f();
}

int main()
{
	A *a = new B();
	print(a);
	
	a = new A();
	print(a);
  	
    system("pause");
	return 0 ;
}
